package com.bjesc_b2c.app.appraiset.utils;

import android.content.Context;

import cn.finalteam.rxgalleryfinal.RxGalleryFinal;
import cn.finalteam.rxgalleryfinal.imageloader.ImageLoaderType;
import cn.finalteam.rxgalleryfinal.rxbus.RxBusResultSubscriber;
import cn.finalteam.rxgalleryfinal.rxbus.event.ImageRadioResultEvent;

/**
 * Created by lenovo on 2017/2/25.
 */
public class RxGralleryFinalUtils {
    public static void openRadioImage(Context context,final RxGalleryFinalCallBack callBack){
        RxGalleryFinal
                .with(context)
                .image()
                .radio()
                .crop()
                .imageLoader(ImageLoaderType.FRESCO)
                .subscribe(new RxBusResultSubscriber<ImageRadioResultEvent>() {
                    @Override
                    protected void onEvent(ImageRadioResultEvent imageRadioResultEvent) throws Exception {
                        if(callBack!=null){
                            callBack.onEvent(imageRadioResultEvent);
                        }
                    }
                })
                .openGallery();
    }

    public interface RxGalleryFinalCallBack{
        void onEvent(ImageRadioResultEvent imageRadioResultEvent);
    }
}
